package com.study.concurrent.A_ThreadManagement.k_HandlingOfUncontrollableExceptionsInThreadGroups;

/**
 * Created by 赵超 on 2017/3/20.
 */
public class MyThreadGroup extends ThreadGroup {
    /**
     * 由于ThreadGroup没有默认的不带参数的无参构造器，所以必须手动声明不带参数的构造器
     * @param name
     */
    public MyThreadGroup(String name) {
        super(name);
    }

    @Override
    public void uncaughtException(Thread t, Throwable e) {
        System.out.printf("线程 %s 抛出一个异常\n", t.getId());
        e.printStackTrace(System.out);
        System.out.printf("Terminating the rest of the Threads\n");
        interrupt();
    }
}
